function addOption(oName,oValue,formName){
	try{
	  if (!IfSelected(oValue,formName)){
		  var obj = $id(formName);
/*		  var oOption = document.createElement("OPTION");
		  oOption.text=oName;
		  oOption.value=oValue;
		  obj.add(oOption);*/
		  
		obj.options.add(new Option(oName,oValue)); 
		
		

	  }
	}
	catch (e){
		alert(e);
	}
}

function IfSelected(sValue,formName){
	var count;
	var i=0;
	var obj = $id(formName);
	count = obj.options.length;
	for(i=0;i<count;i++){
		if (obj.options[i].value==sValue){
		   return true;
		}
	}
	return false;
}

function getSelectedValue(formName){
	var count;
	var i=0;
	var obj = $id(formName);
	count = obj.options.length;
	for(i=0;i<count;i++){
		/*if(obj.options(i).selected){
			return obj.options(i).value;
		}*/
		if(obj.options[i].selected){
			return obj.options[i].value;
		}
	}
}

function setSelectedValue(formName,id){
	var count;
	var i=0;
	var obj = $id(formName);
	count = obj.options.length
	for(i=0;i<count;i++){
		/*if(obj.options(i).value == id){
			obj.options(i).selected = true;
		}*/
		
		if(obj.options[i].value == id){
			obj.options[i].selected = true;
		}
		
	}
	
	

}


function delOption(formName){
	try{
		  var i=0;
		  var count;
		  var obj = $id(formName);
		  count = obj.options.length
		  for(i=count-1;i>=0;i--){						
			  if(obj.options[i].selected){				  		 
				  obj.remove(i);	
				  //f.machineNum.value = obj.options.length; 
			  }
		  }
	}
	catch (e){
		alert(e);
	}
}
	
function delOptionAll(formName){
	try{
		  var i=0;
		  var count;
		  var obj = $id(formName);
		  count = obj.options.length
		  for(i=count-1;i>=0;i--){						
				 obj.remove(i);
		  }
	}
	catch (e){
		alert(e);
	}
}